/*
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2024-04-07 16:17:11
 * @LastEditors: huangtianyang
 * @LastEditTime: 2024-04-28 15:22:32
 * @FilePath: \cxl-driving-training\src\apis\ask\index.ts
 */
import axios from '../../axios/index'

export interface answerParams {
    current?: number
    size?: number
    problemId?: string
}
export interface questionParams {
    current?: number
    size?: number
    content?: string
    schoolId?: string
    auditStatus?: number //审核状态：0未审核；1.通过，2.未通过
}

export interface askOperation {
    content?: string //回答内容
    contentPictures?: string[] //回答内容图片信息
    problemId?: string //问题Id
    signUpCarType?: string //报名车型
    signUpClass?: string //报名班别
    signUpClassId?: string //报名班别id
    signUpPhone?: string //报名手机号
    signUpSchool?: string //报名驾校
    signUpSchoolId?: string //报名驾校id
}

export interface questionAuditParams {
    auditInstructions?: string //审核说明
    auditStatus?: number //审核状态：0未审核；1.通过，2.未通过
    id?: string
}

/**
 * 回答列表
 * @param params
 * @returns
 */
export const answerist = (params: answerParams) => {
    return axios({
        method: 'get',
        url: '/api/system/problemReply/manage/getPageList',
        params
    })
}

/**
 * 添加回答
 * @returns
 */
export const addAsk = (data: askOperation) => {
    return axios({
        method: 'post',
        url: '/api/system/problemReply/manage/add',
        data
    })
}

/**
 * 批量回答
 * @param data
 * @returns
 */
export const batchAddAsk = (data: askOperation[]) => {
    return axios({
        method: 'post',
        url: '/api/system/problemReply/manage/add/batch',
        data
    })
}

/**
 * 问题列表
 * @param params
 * @returns
 */
export const questionList = (params: questionParams) => {
    return axios({
        method: 'get',
        url: '/api/system/problem/manage/getPageList',
        params
    })
}
/**
 * 问题审核
 * @param data
 * @returns
 */
export const questionAudit = (data: questionAuditParams) => {
    return axios({
        method: 'post',
        url: '/api/system/problem/manage/audit',
        data
    })
}

/**
 * 问题详情
 */

export const questionDetailed = (id: string) => {
    return axios({
        method: 'get',
        url: '/api/system/problem/manage/getDetails',
        params: { id }
    })
}
